﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Taurus.Platform.BLL;

namespace Taurus.Garden.BLL
{
    class InitSys
    {
        #region field
        private static InitSys _is;
        private Dictionary<string, MyGarden> _map;

      
        /// <summary>
        /// 账号逻辑
        /// </summary>
        private AccountBll _ab;
        #endregion

        #region construction

        private InitSys()
        {
            _ab = new AccountBll();
            _map = new Dictionary<string, MyGarden>();
        }

        #endregion

        #region property

        public static InitSys Instance
        {
            get
            {
                if (_is == null)
                {
                    _is = new InitSys();
                }
                return _is;
            }
        }

        public SeedMarket SeedMarketInstance { get; set; }

        #endregion

        public void Init()
        {
            foreach (var ua in _ab.GetAllAccount())
            {
                MyGarden mg = new MyGarden(ua);
                _map.Add(ua.UID, mg);
            }
            
        }

        public MyGarden GetMyGarden(string uid)
        {
            return _map[uid];
        }
        public List<MyGarden> GetMyGarden()
        {
            return _map.Values.ToList();
        }
    }
}
